/* 面试题 01.09. 字符串轮转 */
/**
 * @param {string} s1
 * @param {string} s2
 * @return {boolean}
 */

/* 模拟 */
var isFlipedString = function (s1, s2) {
	const m = s1.length,
		n = s2.length
	if (m !== n) return false
	if (n === 0) return true
	for (let i = 0; i < n; i++) {
		let flag = true
		for (let j = 0; j < n; j++) {
			if (s1[(i + j) % n] !== s2[j]) {
				flag = false
				break
			}
		}
		if (flag) return true
	}
	return false
}
var isFlipedString = function (s1, s2) {
	return s1.length === s2.length && (s1 + s1).indexOf(s2) !== -1
}
const result = isFlipedString('abcd', 'acdb')
console.log('result :>>', result)
